<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAccessRolesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('access_roles', function (Blueprint $table) {
            $table->increments('id');                               // id
            $table->string('name', 10)->default('');           // 角色名称
            $table->integer('parent_id')->unsigned()->default(0);   // 上级角色id
            $table->tinyInteger('status')->unsigned()->default(1);  // 状态 【1：开启；2：关闭】
            $table->softDeletes();                                  // 软删除时间
            $table->timestamps();// 时间戳
            $table->unique('name');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('access_roles');
    }
}
